package com.proyecto.core.vista.echo;

import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.app.Window;

/**
 * Application instance implementation.
 */
public class Aplicacion extends ApplicationInstance {

    /**
     * Returns the active <code>ApplicationInstance</code> cast to the 
     * appropriate type.
     * 
     * @return the active <code>ApplicationInstance</code>
     */
    public static Aplicacion getApp() {
        return (Aplicacion) getActive();
    }

    /**
     * Main window of user interface.
     */
    private Window mainWindow;
    
    /**
     * @see nextapp.echo2.app.ApplicationInstance#init()
     */
    public Window init() {
        setStyleSheet(Styles.DEFAULT_STYLE_SHEET);
        mainWindow = new Window();
       // mainWindow.setContent(new LoginScreen());
        return mainWindow;
    }
    
    /**
     * Process a user login request.
     * 
     * @param userName the entered user name
     * @param password the entered password
     * @return true if the user was successfully authenticated
     */
    public boolean processLogin(String userName, String password) {
        // TODO: Replace with authentication code.
        boolean authenticated = userName.equals(password);
        
        if (authenticated) {
            // TODO: Configure screen to display initial screen of application.
        }
        
        return authenticated;
    }
}
